//
//  TimerModel.m
//  AFNetworking
//
//  Created by Henry on 2023/3/7.
//

#import "TimerModel.h"
@interface TimerModel()
@end
@implementation TimerModel


-(NSString *)getApTime{
    NSInteger currenta = 0;
    NSInteger currentb = 0;
    NSString * currentc = 0;
    if(self.Timer.length>=5){
        NSString *de = [self.Timer substringWithRange:NSMakeRange(2, 1)];
        if([@":" isEqualToString:de]){
            NSString *hour = [self.Timer substringToIndex:2];
            NSString *min = [self.Timer substringFromIndex:3];
            if([hour intValue]<=11){
                currentc = @"am";
                if([hour intValue]==0){
                    currenta = 12;
                }else{
                    currenta = [hour intValue];
                }
            }else{
                currentc = @"pm";
                if([hour intValue]==12){
                    currenta = 12;
                }else{
                    currenta = [hour intValue] - 12;
                }
                
            }
            currentb = [min intValue];
        }else{
            currenta = 0;
            currentb = 0;
            currentc = @"AM";
        }
    }else{
        currenta = 0;
        currentb = 0;
        currentc = @"AM";
    }
    
    return [NSString stringWithFormat:@"%02zd:%02zd %@",currenta,currentb,currentc];
}


@end
